#ifndef __BASE_H__
#define __BASE_H__

#define VERSION "draft v1.01"

#define SUCCESS	0
#define FAILURE	-1

#ifndef bool
#define bool int
#define false 0
#define true 1
#endif

#define DAY_HOUR_NUM 24
#define PLAN_CH_NUM 168
#define PLAN_ON '1'
#define PLAN_OFF '0'
#ifndef TRUE		// ADD by jch
#define TRUE 1
#endif

#ifndef FALSE	//ADD by jch
#define FALSE 0
#endif

#define MSGLEVEL 2

#define LOGINFO(fmt, args...)   do{ if( MSGLEVEL >= 2) 	printf ("[%-4d]%-15s(%-4d)%-24s: INFOR	" fmt, getpid(), __FILE__, __LINE__,__func__, ## args); }while(0)
#define LOGTRACE(fmt, args...)  do{ if( MSGLEVEL >= 1) 	printf ("[%-4d]%-15s(%-4d)%-24s: TRACE	" fmt, getpid(), __FILE__, __LINE__,__func__, ## args); }while(0)
#define LOGWARN(fmt, args...)   do{ if( MSGLEVEL >= 0 ) 	printf ("[%-4d]%-15s(%-4d)%-24s: WARN	" fmt, getpid(), __FILE__, __LINE__,__func__, ## args); }while(0)
#define LOGERROR(fmt, args...)  do{ if( MSGLEVEL >= -1) 	printf ("[%-4d]%-15s(%-4d)%-24s: ERROR	" fmt, getpid(), __FILE__, __LINE__,__func__, ## args); }while(0)

#define __DEBUG__
#if defined __DEBUG__
# define dbg(format, arg...) do { printf(format "\n" , ## arg); } while (0)
#else
# define dbg(format, arg...)
#endif

/*  quantities */
typedef unsigned long long      uint64;     	///< Unsigned 64-bit integer
typedef long long  	            int64;      	///< signed 64-bit integer
typedef unsigned int 		 	uint32;       	///< Unsigned 32-bit integer
typedef int 		 			int32;          ///< signed 32-bit integer
typedef unsigned short 		    uint16;        	///< Unsigned 16-bit integer
typedef short 				    int16;          ///< signed 16-bit integer
typedef unsigned char 			uint8;         	///< Unsigned 8-bit integer
typedef char         			int8;           ///< signed 8-bit integer


#endif


